import QtQuick 1.0

// Main window of the example.
Rectangle {
    id:main
    width: 360
    height: 640

    // Call status and Call info windows are added in a row.
    Row{
        width: parent.width
        height: parent.height -50
        Rectangle{
            width: parent.width/2
            height: parent.height
            color: "green"

            // Label for call status.
            Text{
                width: 200
                height: 50
                text: "Call Status"
                color: "white"
            }

            // List view to update the call status information.
            ListView {
                id: callStatusView
                width: parent.width
                height: parent.height-50
                y:50
                model: callStatusModel
                delegate: Text { text: callStatus; color: "white" }
                ListModel { id: callStatusModel }
            }
        }

        Rectangle{
            width: parent.width/2
            height: parent.height
            color: "blue"

            // Label for call info.
            Text{
                width: 200
                height: 50
                text: "Call Info"
                color: "white"
            }

            // List view to update the call information.
            ListView {
                id: callInfoView
                width: parent.width
                height: parent.height-50
                y:50
                model: callInfoModel
                delegate: Text { text: callInfo; color: "white" }
                ListModel { id: callInfoModel }
            }
        }
    }

    Rectangle{
        id:exitButton
        width: parent.width
        y:parent.height-50
        height: 50
        color: "red"
        Text{
            id:buttonText
            text: "Exit"
            color: "white"
            style: Text.Sunken
            anchors.centerIn: parent
        }
        MouseArea{
            id:mouseArea
            anchors.fill: parent
            onClicked:{
                Qt.quit();
            }
        }
    }

    // On receiving connections from callinfo object.
    Connections {
        target: callinfo
        onUpdateCallStatus: {
            callStatusModel.append({'callStatus': info})
        }
        onUpdateCallInfo: {
            callInfoModel.append({'callInfo': info})
        }
    }
}


